home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / info-service / www / src / WWW / Library / Implementation / HText.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-20  |  5.5 KB  |  181 lines

  1. /*                                                           Rich Hypertext object for libWWW
  2.                                   RICH HYPERTEXT OBJECT
  3.                                              
  4.  */
  5.  
  6. /*
  7.  
  8.    This is the C interface to the Objective-C (or whatever) HyperText class.
  9.    
  10.  */
  11. #ifndef HTEXT_H
  12. #define HTEXT_H
  13. #include "HTAnchor.h"
  14. #include "HTStyle.h"
  15. #include "HTStream.h"
  16.  
  17. #ifdef SHORT_NAMES
  18. #define HTMainText                      HTMaText
  19. #define HTMainAnchor                    HtMaAnch
  20. #define HText_new                       HTHTNew
  21. #define HText_new2                      HTHTNew2
  22. #define HText_free                      HTHTFree
  23. #define HText_beginAppend               HTHTBeAp
  24. #define HText_endAppend                 HTHTEnAp
  25. #define HText_setStyle                  HTHTSeSt
  26. #define HText_appendCharacter           HTHTApCh
  27. #define HText_appendText                HTHTApTe
  28. #define HText_appendParagraph           HTHTApPa
  29. #define HText_beginAnchor               HTHTBeAn
  30. #define HText_endAnchor                 HTHTEnAn
  31. #define HText_dump                      HTHTDump
  32. #define HText_nodeAnchor                HTHTNoAn
  33. #define HText_select                    HTHTSele
  34. #define HText_selectAnchor              HTHTSeAn
  35. #define HText_applyStyle                HTHTApSt
  36. #define HText_updateStyle               HTHTUpSt
  37. #define HText_selectionStyle            HTHTStyl
  38. #define HText_replaceSel                HTHTRepl
  39. #define HText_applyToSimilar            HTHTApTo
  40. #define HText_selectUnstyled            HTHTSeUn
  41. #define HText_unlinkSelection           HTHTUnSe
  42. #define HText_linkSelTo                 HTHTLiSe
  43. #define HText_referenceSelected         HTHTRefS
  44. #endif
  45.  
  46. #ifndef THINK_C
  47. #ifndef HyperText               /* Objective C version defined HyperText */
  48. typedef struct _HText HText;    /* Normal Library */
  49. #endif
  50. #else
  51. class CHyperText;               /* Mac Think-C browser hook */
  52. typedef CHyperText HText;
  53. #endif
  54.  
  55. extern HText * HTMainText;              /* Pointer to current main text */
  56. extern HTParentAnchor * HTMainAnchor;   /* Pointer to current text's anchor */
  57.  
  58. /*                      Creation and deletion
  59. **
  60. **      Create hypertext object                                 HText_new
  61. */
  62.  extern HText * HText_new PARAMS((HTParentAnchor * anchor));
  63.  extern HText * HText_new2 PARAMS((HTParentAnchor * anchor,
  64.                                 HTStream * output_stream));
  65.  
  66. /*      Free hypertext object                                   HText_free
  67. */
  68. extern void     HText_free PARAMS((HText * me));
  69.  
  70.  
  71. /*                      Object Building methods
  72. **                      -----------------------
  73. **
  74. **      These are used by a parser to build the text in an object
  75. **      HText_beginAppend must be called, then any combination of other
  76. **      append calls, then HText_endAppend. This allows optimised
  77. **      handling using buffers and caches which are flushed at the end.
  78. */
  79. extern void HText_beginAppend PARAMS((HText * text));
  80.  
  81. extern void HText_endAppend PARAMS((HText * text));
  82.  
  83. /*      Set the style for future text
  84. */
  85. extern void HText_setStyle PARAMS((HText * text, HTStyle * style));
  86.  
  87. /*      Add one character
  88. */
  89. extern void HText_appendCharacter PARAMS((HText * text, char ch));
  90.  
  91. /*      Add a zero-terminated string
  92. */
  93. extern void HText_appendText PARAMS((HText * text, CONST char * str));
  94.  
  95. /*      New Paragraph
  96. */
  97. extern void HText_appendParagraph PARAMS((HText * text));
  98.  
  99. /*      Start/end sensitive text
  100. **
  101. ** The anchor object is created and passed to HText_beginAnchor.
  102. ** The senstive text is added to the text object, and then HText_endAnchor
  103. ** is called. Anchors may not be nested.
  104. */
  105.  
  106. extern void HText_beginAnchor PARAMS((HText * text, HTChildAnchor * anc));
  107. extern void HText_endAnchor PARAMS((HText * text));
  108.  
  109.  
  110. /*      Dump diagnostics to stderr
  111. */
  112. extern void HText_dump PARAMS((HText * me));
  113.  
  114. /*      Return the anchor associated with this node
  115. */
  116. extern HTParentAnchor * HText_nodeAnchor PARAMS((HText * me));
  117.  
  118.  
  119. /*              Browsing functions
  120. **              ------------------
  121. */
  122.  
  123. /*      Bring to front and highlight it
  124. */
  125.  
  126. extern BOOL HText_select PARAMS((HText * text));
  127. extern BOOL HText_selectAnchor PARAMS((HText * text, HTChildAnchor* anchor));
  128.  
  129. /*              Editing functions
  130. **              -----------------
  131. **
  132. **      These are called from the application. There are many more functions
  133. **      not included here from the orginal text object. These functions
  134. **      NEED NOT BE IMPLEMENTED in a browser which cannot edit.
  135. */
  136.  
  137. /*      Style handling:
  138. */
  139. /*      Apply this style to the selection
  140. */
  141. extern void HText_applyStyle PARAMS((HText * me, HTStyle *style));
  142.  
  143. /*      Update all text with changed style.
  144. */
  145. extern void HText_updateStyle PARAMS((HText * me, HTStyle *style));
  146.  
  147. /*      Return style of  selection
  148. */
  149. extern HTStyle * HText_selectionStyle PARAMS((
  150.         HText * me,
  151.         HTStyleSheet* sheet));
  152.  
  153. /*      Paste in styled text
  154. */
  155. extern void HText_replaceSel PARAMS((HText * me,
  156.         CONST char *aString,
  157.         HTStyle* aStyle));
  158.  
  159. /*      Apply this style to the selection and all similarly formatted text
  160. **      (style recovery only)
  161. */
  162. extern void HTextApplyToSimilar PARAMS((HText * me, HTStyle *style));
  163.  
  164. /*      Select the first unstyled run.
  165. **      (style recovery only)
  166. */
  167. extern void HTextSelectUnstyled PARAMS((HText * me, HTStyleSheet *sheet));
  168.  
  169.  
  170. /*      Anchor handling:
  171. */
  172. extern void             HText_unlinkSelection PARAMS((HText * me));
  173. extern HTAnchor *       HText_referenceSelected PARAMS((HText * me));
  174. extern HTAnchor *       HText_linkSelTo PARAMS((HText * me, HTAnchor* anchor));
  175.  
  176.  
  177. #endif /* HTEXT_H */
  178. /*
  179.  
  180.    end  */
  181.